//
//  WNTextField.swift
//  WalkNovel
//
//  Created by Kevin on 2023/7/4.
//

import UIKit

class WNTextField: UITextField {

    var placeholderStr = "" {
        didSet {
            attributedPlaceholder = NSAttributedString.init(string:placeholderStr, attributes: [NSAttributedString.Key.foregroundColor: UIColor.init(named: "gray_CECECE")!])
        }
    }
        
    override init(frame: CGRect) {
        super.init(frame: frame)
        returnKeyType = .done
        tintColor = .init(named: "red_FE95B4")
        textColor = .init(named: "black_333333")
        backgroundColor = .white
        font = .wn_font(name: .bold, size: 13)
        clearButtonMode = .whileEditing
        let clearBtn = self.value(forKey: "_clearButton") as! UIButton
        clearBtn.setImage(UIImage(named: "login_tf_close"), for: .normal)
        borderStyle = .none
        keyboardType = .default
        returnKeyType = .done
        leftView = UIView.init(frame: CGRect.init(x: 0, y: 0, width: 0, height: 1))
        leftViewMode = .always
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
